<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="d" uri="http://www.trkj.com/tr1702/tags" %>
<!DOCTYPE html PUBLIC "-//w3_professionalC//DTD HTML 4.01 Transitional//EN" "http://www.w3_professional.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>"/>
<link rel="stylesheet" href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
$(".xinz_professional").linkbutton({
	onClick:function(){
		$("#w3_professional").dialog("open");
	}
});

//删除
$(".sc_wdm_professional").linkbutton({onClick:function(){
	var rowInfo = $("#yglz-wdm_professional").datagrid('getSelected');
	if(rowInfo){
		$.messager.confirm('确认', '您确定要删除该条数据吗？', function(v){
			if(v){
				var zcId = $("#yglz-wdm_professional").datagrid("getSelected").zcId;
				alert(zcId);
				$.getJSON("delete_professional",{zcId:zcId},function(v){
					if(v){
						$('#yglz-wdm_professional').datagrid('reload');   
					}else{
						$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
					}
				});
			}
			
		});
	}else{
		$.messager.alert('错误', '对不起，操作失败，没有选中的行');
	}
	
}});
//编辑
$(".jz_wdm_professional").linkbutton({onClick:function(){
	var rowInfo = $("#yglz-wdm_professional").datagrid('getSelected');
	if(rowInfo){
		var zcId = $("#yglz-wdm_professional").datagrid("getSelected").zcId;
		var zcName = $("#yglz-wdm_professional").datagrid("getSelected").zcName;
		var zcSalary = $("#yglz-wdm_professional").datagrid("getSelected").zcSalary;
		
		$("#win2_professional").dialog("open");
		$('#wdm_reasons_for_professional2').form('load','load_professional?zcId='+zcId);
		
	}else{
		$.messager.alert('错误', '对不起，操作失败，没有选中的行');
	}
	
}});
//模糊查询
function doSearch(value,name){
	$('.yglz-wdm_professional').datagrid({ url: 'modaddSeslect_professional?text='+value});//重新指定url
    $('.yglz-wdm_professional').datagrid('load',{  
   		
    });

}




</script>
	<table id="yglz-wdm_professional" class="easyui-datagrid yglz-wdm_professional" data-options="
				url:'queryByto_professional',
				pageList:[2,4,6,8,10],
				pageSize:10,
				pagination:true,
				method:'get',
				fitColumns:true,
				fit:true,
				nowrap:false,
				autoRowHeight:true,
				singleSelect:true,
				striped:true,
				toolbar:'#wdm3_professional'
				">
			<thead>
				<tr>
					<th data-options="field:'zcId',width:'15%',align:'center'">职称编号</th>
					<th data-options="field:'zcName',width:'15%',align:'center'">职称名称</th>
					<th data-options="field:'zcSalary',width:'15%',align:'center'">职称工资</th>
		
					
				</tr> 
			</thead>
			<tbody>
			</tbody>
		</table>
		<d:g id="22">
		<div id="wdm3_professional">
					<a href="#" class="xinz_professional" data-options="iconCls:'icon-add',plain:true,text:'新增',iconAlign:'left'"></a>| 
                <a href="#" class="easyui-linkbutton jz_wdm_professional" data-options="iconCls:'icon-edit',plain:true,text:'编辑',iconAlign:'left'"></a>| 
                <a href="#" class="easyui-linkbutton sc_wdm_professional" id="sc_wdm_professional" data-options="iconCls:'icon-remove',plain:true,text:'删除',iconAlign:'left'"></a>| 
				搜索内容
				<input id="ss" class="easyui-searchbox sousuo"
						searcher="doSearch" prompt="请输入职称名"
						style="width: 200px; vertical-align: middle;"></input> 
		</div>
		</d:g>
<div id="mm" style="width:120px"> 
		</div>
		
		<div id="w3_professional" class="easyui-dialog"
			data-options="width:500,
						height:190,
						title:'定义职称',
						modal:true,
						closed:true,
						buttons:[{
					text:'添加',
					iconCls:'icon-ok',
					handler:function(){
							$('#wdm_reasons_for_professional').form({
							onSubmit:function(params){
								return $('#wdm_reasons_for_professional').form('validate');
							},success:function(v){
								v=eval('('+ v + ')');
								if(v.success){
									$('#w3_professional').dialog('close');
									$('#yglz-wdm_professional').datagrid('reload');
									$('#wdm_reasons_for_professional').form('reset');
								}else{
									$.messager.alert('错误', v.message);
								}
							}
						
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#w3_professional').dialog('close');
					}
				}]">
	 		<form action="insert_professional" method="post"  id="wdm_reasons_for_professional">
				<div style="margin-left:60px;margin-top:10px;">*职称名称：<input class="easyui-textbox" id="zcName" name="zcName" data-options="width:'80%',required:true"/></div>
				<div style="margin-left:60px;margin-top:20px;" >*职称工资：<input class="easyui-textbox" id="zcSalary" name="zcSalary" data-options="width:'80%',required:true"/></div>
			</form>
		</div>
			
			
			
		<div id="win2_professional" class="easyui-dialog"
			data-options="width:500,
						height:220,
						title:'定义职称',
						modal:true,
						closed:true,
						buttons:[{
					text:'添加',
					iconCls:'icon-ok',
					handler:function(){
						$('#wdm_reasons_for_professional2').form({
							onSubmit:function(params){
								return $('#wdm_reasons_for_professional2').form('validate');
							},success:function(v){
								v=eval('('+ v + ')');
								if(v.success){
									$('#win2_professional').dialog('close');
									$('#yglz-wdm_professional').datagrid('reload');
									$('#wdm_reasons_for_professional2').form('reset');
								}else{
									$.messager.alert('错误', v.message);
								}
							}
						
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#win2_professional').dialog('close');
					}
				}]">
	 		<form action="update_professional" method="post"  id="wdm_reasons_for_professional2" >
	 			<div style="margin-left:60px;margin-top:10px;">*职称编号：<input class="easyui-textbox" id="zcId" name="zcId" data-options="width:'80%',readonly:true"/></div>
				<div style="margin-left:60px;margin-top:10px;">*职称名称：<input class="easyui-textbox" id="zcName" name="zcName" data-options="width:'80%',required:true"/></div>
				<div style="margin-left:60px;margin-top:20px;" >*职称工资：<input class="easyui-textbox" id="zcSalary" name="zcSalary" data-options="width:'80%',required:true"/></div>
			</form>
		</div>			
</body>
</html>